/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-07-19
 * 19:07
 */
public class Test {
    public static void main(String[] args) {
        int[] elem={3,34,5,667,87,54,3,67,80};
        PriorityQueue priorityQueue=new PriorityQueue(10);

        priorityQueue.createHeap(elem);
        priorityQueue.push(999);
        System.out.println(priorityQueue.pollHeap());
        System.out.println(priorityQueue.peekHeap());
    }

    public static int[] smallestK(int[] arr, int k) {
        int[] ret=new int[k];
        if(ret==null||k==0){
            return ret;
        }
        PriorityQueue priorityQueue1=new PriorityQueue(arr.length);
        for(int i=0;i<arr.length;i++){
            priorityQueue1.push(arr[i]);
        }
        for (int i = 0; i < k; i++) {
            int val=priorityQueue1.peekHeap();
            priorityQueue1.pollHeap();
            ret[i]=val  ;
        }
        return ret;
    }
}
